<template>
	<view>
		<view class="mainpadding_top">
			<view class="margin_top flexcolumn">
				<view class="titletext hei_text bold">实付青统币</view>
				<view class="margin_top6 hei_text bold" style="font-size: 60rpx;">{{pay_price}}</view>
			</view>
			<view class="mainpadding_top flexbetween margin_top6 ffffff radius">
				<view class="flexleft">
					<!-- <image class="iconclass margin_right3" src="../static/images/system/score.png" mode=""></image> -->
					<view class="titletext hei_text">青统币（可用{{userInfo.score}}）</view>
				</view>
				<u-icon name="checkmark-circle-fill" color="#ff8505" size="24"></u-icon>
			</view>
		</view>
		<view class="mainpadding gudingdb">
			<view class="bigbtn" @click="jifenPay()">立即兑换</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				pay_price: "",
				userInfo: {},
				order_id: "",
				pay_type: 10
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.msg))
			this.pay_price = data.pay_price
			this.order_id = data.order_id
			this.init()	
		},
		methods: {
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
			jifenPay() {
				httpRequest.request('/api/order/payment', 'POST', {
					order_id: this.order_id,
				}).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						setTimeout(() => {
							uni.navigateBack(1)
						}, 1000)
					}
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.iconclass {
		width: 40rpx;
		height: 40rpx;
	}
</style>